home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / WIN / VB_DB / PROFIT.ZIP / SUBSINGR.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-03-19  |  7.9 KB  |  258 lines

  1. VERSION 2.00
  2. Begin Form SubsIngr 
  3.    BackColor       =   &H00E0FFFF&
  4.    Caption         =   "Substitute Ingredient"
  5.    Height          =   3300
  6.    Icon            =   SUBSINGR.FRX:0000
  7.    Left            =   1035
  8.    LinkTopic       =   "SubsIngr"
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    ScaleHeight     =   2895
  12.    ScaleWidth      =   6645
  13.    Top             =   1140
  14.    Width           =   6765
  15.    Begin CommandButton CmdClose 
  16.       Caption         =   "&Close"
  17.       Height          =   495
  18.       Left            =   1560
  19.       TabIndex        =   9
  20.       Top             =   2295
  21.       Width           =   1215
  22.    End
  23.    Begin CommandButton CmdReplace 
  24.       Caption         =   "&Replace"
  25.       Height          =   495
  26.       Left            =   240
  27.       TabIndex        =   8
  28.       Top             =   2280
  29.       Width           =   1215
  30.    End
  31.    Begin TextBox TxtNew 
  32.       Height          =   495
  33.       Left            =   1905
  34.       TabIndex        =   5
  35.       Top             =   1245
  36.       Width           =   2460
  37.    End
  38.    Begin TextBox TxtOld 
  39.       Height          =   495
  40.       Left            =   1920
  41.       TabIndex        =   1
  42.       Top             =   285
  43.       Width           =   2430
  44.    End
  45.    Begin Label LblNewUnits 
  46.       BackColor       =   &H00E0FFFF&
  47.       Height          =   345
  48.       Left            =   4455
  49.       TabIndex        =   6
  50.       Top             =   1320
  51.       Width           =   1920
  52.    End
  53.    Begin Label LblOldUnits 
  54.       BackColor       =   &H00E0FFFF&
  55.       Height          =   345
  56.       Left            =   4425
  57.       TabIndex        =   2
  58.       Top             =   315
  59.       Width           =   1830
  60.    End
  61.    Begin Label LblNewDesc 
  62.       BackColor       =   &H00E0FFFF&
  63.       Height          =   330
  64.       Left            =   1905
  65.       TabIndex        =   7
  66.       Top             =   1830
  67.       Width           =   4635
  68.    End
  69.    Begin Label LblOldDesc 
  70.       BackColor       =   &H00E0FFFF&
  71.       Height          =   345
  72.       Left            =   1920
  73.       TabIndex        =   3
  74.       Top             =   840
  75.       Width           =   4455
  76.    End
  77.    Begin Label LblMessage 
  78.       BackColor       =   &H00E0FFFF&
  79.       Height          =   360
  80.       Left            =   2880
  81.       TabIndex        =   10
  82.       Top             =   2370
  83.       Width           =   3660
  84.    End
  85.    Begin Label LblNew 
  86.       BackColor       =   &H00E0FFFF&
  87.       Caption         =   "&New Ingredient"
  88.       Height          =   330
  89.       Left            =   255
  90.       TabIndex        =   4
  91.       Top             =   1335
  92.       Width           =   1500
  93.    End
  94.    Begin Label LblOld 
  95.       BackColor       =   &H00E0FFFF&
  96.       Caption         =   "&Old Ingredient"
  97.       Height          =   315
  98.       Left            =   240
  99.       TabIndex        =   0
  100.       Top             =   360
  101.       Width           =   1560
  102.    End
  103. Sub CmdClose_Click ()
  104.   Unload SubsIngr
  105. End Sub
  106. Sub CmdReplace_Click ()
  107.       ChangesMade% = False
  108.       ValidOld% = False
  109.       IngredientRec.IngKey = TxtOld.Text + String$(15 - Len(TxtOld.Text), " ")
  110.       ReadIngredient
  111.       Select Case IngredientSt%
  112.         Case 0
  113.           LblOldDesc.Caption = IngredientRec.IngDesc
  114.           LblOldUnits.Caption = IngredientRec.IngUnitDesc
  115.           ValidOld% = True
  116.           OldUnits$ = IngredientRec.IngUnitDesc
  117.         Case 3
  118.           MsgIngredientNotOpen
  119.           LblOldDesc.Caption = ""
  120.           LblOldUnits.Caption = ""
  121.         Case 4
  122.           MsgBox "Old ingredient is not on file."
  123.           LblOldUnits.Caption = ""
  124.           LblOldDesc.Caption = ""
  125.         Case Else
  126.           MsgUnknownIngredientError
  127.           LblOldUnits.Caption = ""
  128.           LblOldDesc.Caption = ""
  129.       End Select
  130.       If ValidOld% Then
  131.         ValidNew% = False
  132.         IngredientRec.IngKey = TxtNew.Text + String$(15 - Len(TxtNew.Text), " ")
  133.         ReadIngredient
  134.         Select Case IngredientSt%
  135.           Case 0
  136.             LblNewDesc.Caption = IngredientRec.IngDesc
  137.             LblNewUnits.Caption = IngredientRec.IngUnitDesc
  138.             ValidNew% = True
  139.             NewUnits$ = IngredientRec.IngUnitDesc
  140.           Case 3
  141.             MsgIngredientNotOpen
  142.             LblNewDesc.Caption = ""
  143.             LblNewUnits.Caption = ""
  144.           Case 4
  145.             MsgBox "New ingredient is not on file."
  146.             LblNewDesc.Caption = ""
  147.             LblNewUnits.Caption = ""
  148.           Case Else
  149.             MsgUnknownIngredientError
  150.             LblNewDesc.Caption = ""
  151.             LblNewUnits.Caption = ""
  152.         End Select
  153.         If ValidNew% Then
  154.           If OldUnits$ = NewUnits$ Then
  155.             LblMessage.Caption = "Processing..."
  156.             RecipeDetSt% = 0
  157.             While RecipeDetSt% = 0
  158.               t% = DoEvents()
  159.               RecipeDetRec.RecDetKey = "      " + TxtOld.Text + String$(15 - Len(TxtOld.Text), " ")
  160.               ReadRecipeDetKey1
  161.               If RecipeDetSt% = 0 Then
  162.                 RecipeDetRec.RecDetKey = Left$(RecipeDetRec.RecDetKey, 6) + TxtNew.Text + String$(15 - Len(TxtNew.Text), " ")
  163.                 UpdateRecipeDetKey1
  164.                 If RecipeDetSt% = 0 Then
  165.                   ChangesMade% = True
  166.                 End If
  167.               End If
  168.             Wend
  169.             If ChangesMade% Then
  170.               LblMessage.Caption = "Completed successfully."
  171.               TxtNew.Text = ""
  172.               TxtOld.Text = ""
  173.               LblNewDesc.Caption = ""
  174.               LblOldDesc.Caption = ""
  175.               LblNewUnits.Caption = ""
  176.               LblOldUnits.Caption = ""
  177.               TxtOld.SetFocus
  178.             Else
  179.               LblMessage.Caption = "No changes were made."
  180.             End If
  181.           Else
  182.             MsgBox "Recipe unit descriptions must be the same on both ingredients."
  183.           End If
  184.         End If
  185.       End If
  186.       ReadRecipeDet
  187. End Sub
  188. Sub Form_Load ()
  189.     Height = 3300
  190.     Width = 6675
  191. End Sub
  192. Sub TxtNew_KeyPress (KeyAscii As Integer)
  193.   If KeyAscii = 13 Then
  194.     LblMessage.Caption = ""
  195.     KeyAscii = 0
  196.     If TxtNew.Text <> "" Then
  197.       IngredientRec.IngKey = TxtNew.Text + String$(15 - Len(TxtNew.Text), " ")
  198.       ReadIngredient
  199.       Select Case IngredientSt%
  200.         Case 0
  201.           LblNewDesc.Caption = IngredientRec.IngDesc
  202.           LblNewUnits.Caption = IngredientRec.IngUnitDesc
  203.           TxtOld.SetFocus
  204.         Case 3
  205.           MsgIngredientNotOpen
  206.           LblNewDesc.Caption = ""
  207.           LblNewUnits.Caption = ""
  208.           TxtNew.SetFocus
  209.         Case 4
  210.           MsgBox "New ingredient is not on file."
  211.           LblNewDesc.Caption = ""
  212.           LblNewUnits.Caption = ""
  213.           TxtNew.SetFocus
  214.         Case Else
  215.           MsgUnknownIngredientError
  216.           LblNewDesc.Caption = ""
  217.           LblNewUnits.Caption = ""
  218.           TxtNew.SetFocus
  219.       End Select
  220.     End If
  221.   Else
  222.     UCStrKP TxtNew, 15, KeyAscii
  223.   End If
  224. End Sub
  225. Sub TxtOld_KeyPress (KeyAscii As Integer)
  226.   If KeyAscii = 13 Then
  227.     LblMessage.Caption = ""
  228.     KeyAscii = 0
  229.     If TxtOld.Text <> "" Then
  230.       IngredientRec.IngKey = TxtOld.Text + String$(15 - Len(TxtOld.Text), " ")
  231.       ReadIngredient
  232.       Select Case IngredientSt%
  233.         Case 0
  234.           LblOldDesc.Caption = IngredientRec.IngDesc
  235.           LblOldUnits.Caption = IngredientRec.IngUnitDesc
  236.           TxtNew.SetFocus
  237.         Case 3
  238.           MsgIngredientNotOpen
  239.           LblOldDesc.Caption = ""
  240.           LblOldUnits.Caption = ""
  241.           TxtOld.SetFocus
  242.         Case 4
  243.           MsgBox "Old ingredient is not on file."
  244.           LblOldDesc.Caption = ""
  245.           LblOldUnits.Caption = ""
  246.           TxtOld.SetFocus
  247.         Case Else
  248.           MsgUnknownIngredientError
  249.           LblOldDesc.Caption = ""
  250.           LblOldUnits.Caption = ""
  251.           TxtOld.SetFocus
  252.       End Select
  253.     End If
  254.   Else
  255.     UCStrKP TxtOld, 15, KeyAscii
  256.   End If
  257. End Sub
  258.